<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>学生答题</title>
<style>
</style>
<script src="https://cdn.bootcss.com/vue/2.6.11/vue.min.js"></script>
<script src="https://cdn.bootcss.com/axios/0.19.2/axios.js"></script>
<script src="./javascripts/client.socket.js"></script>
</head>
<body>
	<div id="app">
		<div @click="getFile">获取图片</div>
		<img :src="url" alt="">
	</div>

	<script>
		let vm = new Vue({
			el: '#app',
			data: {
				url: '',
				timer: null
			},
			mounted() {
				
			},
			methods: {
				getFile () {
					let that = this
					that.timer = setInterval(() => {
					axios.get('/upload/file').then(resp => {
						console.log(resp)
						that.url = resp.data
						clearInterval(that.timer)
					})
				}, 2000)
				}
			},
			beforeDestroy() {
				clearInterval(this.timer)
			}
		})

	</script>
</body>
</html>
